Unit BDijitButtonUnit;

{$mode objfpc}{$H+}

Interface

Uses
  Classes, SysUtils, BDojoSessionUnit, BDijitFormWidgetUnit;

Type

{ BDijitButtonClass }

//** Buttons can display a label, an icon, or both. A label should always be
//** specified (through innerHTML) or the label attribute. It can be hidden via
//** showLabel=false.

BDijitButtonClass = Class(BDijitFormWidgetClass)
  Private
    bShowLabel: Boolean;
    Procedure SetShowLabel(aValue: Boolean);
  Public
    //** Set this to true to hide the label text and display only the icon.
    //** (If showLabel=false then iconClass must be specified.) Especially
    //** useful for toolbars. If showLabel=true, the label will become the
    //** title (a.k.a. tooltip/hint) of the icon. The exception case is for
    //** computers in high-contrast mode, where the label will still be
    //** displayed, since the icon doesn't appear.
    Property ShowLabel: Boolean Read bShowLabel Write SetShowLabel;

    Constructor Build(Const aSession: BDojoSessionClass;
      Const aJSType: String = ''); Override;
End;

Implementation

{ BDijitButtonClass }

Procedure BDijitButtonClass.SetShowLabel(aValue: Boolean);
Begin
  bShowLabel:=aValue;
  SetConfig('showLabel', aValue);
End;

Constructor BDijitButtonClass.Build(Const aSession: BDojoSessionClass;
  Const aJSType: String);
Begin
  If aJSType = '' Then Inherited Build(aSession, 'dijit.form.Button')
  Else Inherited Build(aSession, aJSType)
End;

End.

